import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
// import px2vw from '@yuo/postcss-px2vw'
import {fileURLToPath, URL} from 'url'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ArcoResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ArcoResolver()],
    }),
    Components({
      resolvers: [
        ArcoResolver({
          sideEffect: true
        })
      ]
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  css: {
    postcss: {
      plugins: [
        // px2vw({
        //   unitToConvert: 'px',
        //   viewportWidth: 1920,
        //   unitPrecision: 5,
        //   propList: ['*'],
        //   viewportUnit: 'vw',
        //   fontViewportUnit: 'vw',
        //   selectorBlackList: [],
        //   minPixelValue: 1,
        //   mediaQuery: false,
        //   replace: true,
        //   landscape: false
        // })
      ]
    }
  },
  server: {
    host: '0.0.0.0'
  }
})
